/*
 * @file     g_type.h
 * @brief    source file for setting type
 *
 * Change Logs:
 * Date           Author      Version        Notes
 * 2020-11-05     wushengyan         V1.0.0         the first version
 */

#ifndef __G_TYPE_H__
#define __G_TYPE_H__

/*
__CC_ARM    :MDK(keil)
__GNUC__    :gcc
__ICCARM__  :iar

*/

#if defined ( __CC_ARM  )
typedef unsigned char      uint8_t;
typedef unsigned short     uint16_t;
typedef unsigned int       uint32_t;
typedef unsigned long long uint64_t;
typedef unsigned char      byte;
typedef unsigned short     word;

typedef signed char       int8_t;
typedef signed short      int16_t;
typedef signed int        int32_t;
typedef signed long long  int64_t;
#else
#include "stdio.h"
typedef unsigned char      byte;
typedef unsigned short     word;
#endif
typedef unsigned char       u8;
typedef unsigned short     int  u16;
typedef unsigned           int  u32;
#ifndef __ICCARM__
typedef unsigned int size_t;
#endif

//typedef signed long      s32;
typedef signed short     s16;
typedef signed char      s8;
#ifndef G_Boolean
typedef enum {FALSE = 0, TRUE = 1} G_Boolean;
#define IS_BOOLEAN(bool) ((bool == FALSE) || (bool == TRUE))
#endif

#ifndef G_FunctionalState
typedef enum {DISABLE = 0, ENABLE = 1} G_FunctionalState;
#define IS_FUNCTIONAL_STATE(state) ((state== DISABLE) || (state == ENABLE))
#endif

#ifndef G_ErrorStatus
typedef enum {ERROR = 0, SUCCESS = 1} G_ErrorStatus;
#define IS_ERROR_STATE(status) ((status== ERROR) || (status == SUCCESS))
#endif

#ifndef G_FlagStatus
typedef enum {RESET = 0, SET = !RESET} G_FlagStatus, G_ITStatus;
#endif

#ifndef G_NULL
#define G_NULL                         (0)
#endif

#ifndef NULL
#define NULL							(0)
#endif

#endif /*__G_TYPE_H__*/

